package com.kj.xuyuan.http;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class HeaderInterceptor implements Interceptor  {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request original = chain.request();
        Request request = original.newBuilder()
                .addHeader("Content-Type", "application/json; charset=utf-8")
                .header("Accept-Encoding", "identity") // 解决 IOException: unexpected end of stream on Connection
                .build();
        return chain.proceed(request);
    }
}
